package com.yunji.cabinet.enums;

/**
 * @version 1.0
 * @Project: yunji-coffee
 * @Package com.yunji.netty.enums
 * @FileName MessageEnum.java
 * @Copyright Copyright © 2024 云集互联. All Rights Reserved
 * Company		com
 * @CreateTime 2024-07-29 14:46:08
 * @Description 货柜代码枚举
 * @Modification Author                    History Time			Version				Description
 * --------------------------------------------------------------------------------
 * HuaAo0803@163.com	2024-04-13 10:24:14		1.0					1.0 Version
 * @since JDK 1.8.0_202
 */
public enum CabinetEnum {
    HEALTHY(1, "心跳交互"),
    OPERATE(2, "货柜操作"),
    CHECKED(3, "货柜检查"),
    VERSION(4, "货柜版本"),
    UPGRADE(10, "固件升级");

    private final Integer code;
    private final String text;

    CabinetEnum(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public static String get(Integer code) {
        if (null == code) {
            return null;
        }

        for (CabinetEnum e : CabinetEnum.values()) {
            if (e.code.equals(code)) {
                return e.text;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getText() {
        return text;
    }
}
